package com.dk.service.impl;

import com.dk.entity.DtGoods;
import com.dk.mapper.DtGoodsMapper;
import com.dk.service.IDtGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品表，SPU表 服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtGoodsServiceImpl implements IDtGoodsService {

    @Autowired
    private DtGoodsMapper mapper;
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @Override
    public void updateStatus(Long id, Integer status) {
        DtGoods goods = new DtGoods();
        goods.setId(id).setIsMarketable(status.toString());
        mapper.updateById(goods);

        rocketMQTemplate.convertAndSend("goodsId",id);
    }
}
